package com.dl7.mvp.video.bean;

import android.os.Parcel;
import android.os.Parcelable;

public class VideoInfo implements Parcelable{
    private String url;
    private int playCount;
    private String name;
    private String image;
    private int albumId;

    // ===================
    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeString(url);
        parcel.writeInt(playCount);
        parcel.writeString(name);
        parcel.writeString(image);
        parcel.writeInt(albumId);
    }

    protected VideoInfo(Parcel in) {
        url = in.readString();
        playCount = in.readInt();
        name = in.readString();
        image = in.readString();
        albumId = in.readInt();
    }

    public static final Creator<VideoInfo> CREATOR = new Creator<VideoInfo>() {
        @Override
        public VideoInfo createFromParcel(Parcel in) {
            return new VideoInfo(in);
        }

        @Override
        public VideoInfo[] newArray(int size) {
            return new VideoInfo[size];
        }
    };

    // ===================
    /**
     * 通过推荐的Video构建
     * @param videoBean
     */
    public VideoInfo(RcmdVideoList.DataBean.VideoBean videoBean) {
        url = videoBean.getResource();
        name = videoBean.getName();
        image = videoBean.getImage();
        playCount = videoBean.getPlayCount();
        albumId = videoBean.getAlbumId();
    }

    /**
     * 通过推荐专辑构建
     * @param videoBean
     */
    public VideoInfo(RcmdVideoAlbumList.VideoBean videoBean) {
        name = videoBean.getName();
        image = videoBean.getIconUrl();
        playCount = videoBean.getPlayCount();
        albumId = videoBean.getId();
    }

    /**
     * 通过专辑详情构建
     * @param data
     */
    public VideoInfo(VideoAlbumList.AlbumBean data) {
        url = data.getResource();
        name = data.getName();
        image = data.getImage();
        playCount = data.getPlayCount();
        albumId = data.getAlbumId();
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public int getPlayCount() {
        return playCount;
    }

    public void setPlayCount(int playCount) {
        this.playCount = playCount;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public int getAlbumId() {
        return albumId;
    }

    public void setAlbumId(int albumId) {
        this.albumId = albumId;
    }
}
